package com.stars.services.impl.system;
import com.github.pagehelper.PageInfo;
import com.stars.entity.dto.sysdict.SysDictDTO;
import com.stars.entity.system.SysRoleEntity;
import com.stars.services.system.SysRoleAccessServices;
import com.stars.dao.mapper.system.SysRoleMapper;
import com.stars.entity.dto.system.SysRoleDTO;

import java.util.List;
import com.stars.entity.ListPage;
import com.github.pagehelper.PageHelper;
import com.stars.services.impl.BaseAccessServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Title: 角色表、角色管理表 业务逻辑
 * @author dj
 * @date 2019-10-14 19:52:12
 * @version V1.0
 *
 */
@Service
public class SysRoleAccessServicesImpl  extends BaseAccessServiceImpl<SysRoleMapper , SysRoleEntity> implements  SysRoleAccessServices {
    @Autowired
    private SysRoleMapper  sysRoleMapper;

    @Override
    public List<SysRoleDTO> roleList(Integer pageNum, Integer pageSize,SysRoleDTO dto) throws Exception{
        ListPage<SysRoleDTO> listPage = new ListPage<>(pageNum, pageSize, dto);
        PageHelper.startPage(pageNum, pageSize);
        return sysRoleMapper.pageQuerySysRole(listPage);
    }

    /**
     * 分页查询
     * @param pageNum 查询参数 起始页，大小。
     * @return
     */
    @Override
    public PageInfo<SysRoleDTO> pageList(Integer pageNum, Integer pageSize, SysRoleDTO dto) throws Exception{
        List<SysRoleDTO> list = roleList(pageNum,pageSize,dto);
        PageInfo<SysRoleDTO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
